
#include "pcm2g711.h"

#define IN_FILENAME		    "out.g711"
#define OUT_FILENAME		"out.pcm"


int main(void)
{
	int ret = 0;
    FILE *in_file = NULL;
    FILE *out_file = NULL;
    
    char  in_data = 0;
    short  out_data = 0;
	
	in_file = fopen(IN_FILENAME,"rb");
    if(in_file == NULL)
    {
        printf("open in file error!\n");
    }
    
	out_file = fopen(OUT_FILENAME,"wb");
    if(out_file == NULL)
    {
        printf("open out file error!\n");
    }
    
	while(1)
	{
		ret = fread(&in_data,1,1,in_file);
		if(ret != 1)
		{
			printf("ret = %d\n");
			printf("fread file over!\n");
            break;
		}
        //out_data = ALawEncode(in_data);
        out_data = ALawDecode(in_data);
        if(fwrite(&out_data,2,1,out_file) != 1)
        {
            printf("fwrite error\n");
        }

	}
    
	fclose(in_file);
	fclose(out_file);
    printf("Done!\n");
}





  





